﻿using System;
using XSTDZ.ERP.Application.DataContracts;
using System.Collections.Generic;

namespace XSTDZ.ERP.Application
{
   public interface IUserService
    {
       /// <summary>
       /// 添加用户
       /// </summary>
       /// <param name="userDto"></param>
       /// <returns></returns>
       Guid AddUser(UserDto userDto);
       /// <summary>
       /// 更新用户
       /// </summary>
       /// <param name="userDto"></param>
       void UpdateUser(UserDto userDto);
       /// <summary>
       /// 根据用户ID，获得用户信息
       /// </summary>
       /// <param name="userid"></param>
       /// <returns></returns>
       UserDto GetUser(Guid userid);
       /// <summary>
       /// 删除用户
       /// </summary>
       /// <param name="userId"></param>
       void DeleteUser(Guid userId);

       /// <summary>
       /// 禁用(启用)用户
       /// </summary>
       /// <param name="userId"></param>
       void DisableUser(Guid userId,bool isEnable);
       /// <summary>
       /// 根据用户名和密码获得用户(登陆用)
       /// </summary>
       /// <param name="userName"></param>
       /// <param name="userPassword"></param>
       /// <returns></returns>
       UserDto GetUser(string userName, string userPassword);

       /// <summary>
       /// 获得用户所属的组织机构ID
       /// </summary>
       /// <param name="userId"></param>
       /// <returns></returns>
       Guid GetUserOrg(Guid userId);
       /// <summary>
       /// 获得所有用户
       /// </summary>
       /// <returns></returns>
       IEnumerable<UserDto> GetAllUser();
       /// <summary>
       /// 判断指定的用户是否有指定的Controller/Action权限
       /// </summary>
       /// <param name="userid"></param>
       /// <param name="controllerName"></param>
       /// <param name="actionName"></param>
       /// <returns></returns>
       bool IsAuthoraized(Guid userid, string controllerName, string actionName);

       /// <summary>
       /// 判断登陆用户名是否存在
       /// </summary>
       /// <param name="loginName"></param>
       /// <returns></returns>
       bool IsExists(string loginName);

       IEnumerable<Guid> GetUiPermissionIds(Guid userId, string controllerName, string actionName, out bool isExistPermission);
       IEnumerable<Guid> GetPermissionIds(Guid userId);
    }
}
